<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  
<!-- Mirrored from bos.asmhackers.net/docs/filesystems/ntfs/seqarray.html by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 07 Oct 2014 11:26:07 GMT -->
<head>
    <title>NTFS Documentation: Update Sequence Technique</title>
  </head>

  <body>
      <h1><a href="index-2.html#NTFS" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/index.html#NTFS">NTFS</a> Documentation: Update Sequence Technique</h1>

      <h2>Interest</h2>

      The purpose of update sequence technique (also called fixup technique in the <a href="javascript:if(confirm('http://www.linux.org/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.linux.org/'" tppabs="http://www.linux.org/">Linux</a> driver) is to detect incomplete multi-<a href="glossary.html#Sector" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Sector">sector</a> transfers. All important <a href="glossary.html#Metadata" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Metadata">metadata</a> structures use this technique:
      <p>

      <ul>
	<li><a href="FILE.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/FILE.html">FILE record</a>s
	<li><a href="INDX.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/INDX.html">INDX buffer</a>s
	<li>RCRD
	<lI>RSTR
      </ul>
      <p>

      <h2>How it works</h2>

      Writing a structure to the storage unit involves the following operations:
      <ol>
        <li>In memory, increment by one the <a name="up_seq">update sequence</a> (a value stored in the header part of the structure). The value 00 00 must be skipped.
        <li>In memory, patch the update sequence at the end of each <a href="glossary.html#Sector" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Sector">sector</a> of the structure, and save the original value in the <a name="up_seq_a">update sequence array</a> (an array located in the header part of the structure)
        <li>Copy the structure from memory to the storage unit
      </ol>
      <p>

      Reading a structure from the storage unit involves the following operations:
      <ol>
        <li>Copy the structure from the storage unit to memory
        <li>In memory, check if its <a name="magic">magic number</a> is correct
        <li>In memory, check if the end of each <a href="glossary.html#Sector" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Sector">sector</a> of the structure is the update sequence
          <ul>
            <li>If this is not the case, it means that the last write operation of this structure has not been completed (e.g. a power failure happened in the middle of the operation)
            <li>If this is the case, restore in memory the original values at the end of each <a href="glossary.html#Sector" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Sector">sector</a> of the structure from the update sequence array
          </ul> 
      </ol>
      <p>

      <em>Note</em>:
      <ul>
        <li>Because we don't know in which order the storage unit actually writes physical <a href="glossary.html#Sector" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Sector">sector</a>s, we must patch the end of <em>each</em> <a href="glossary.html#Sector" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Sector">sector</a> of the structure, instead of just the end of <em>the last</em> <a href="glossary.html#Sector" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Sector">sector</a> of the structure.
        <li>Here we rely on the hardware to check data integrity with checksum techniques.
      </ul>
      <p>

      <hr>
      <address><a href="mailto:regis@via.ecp.fr">Regis Duchesne</a> at <a href="javascript:if(confirm('http://www.via.ecp.fr/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.via.ecp.fr/'" tppabs="http://www.via.ecp.fr/">VIA</a>, <a href="javascript:if(confirm('http://www.ecp.fr/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.ecp.fr/'" tppabs="http://www.ecp.fr/">ECP</a>, France</address>
<!-- Created: Tue Dec 10 19:28:35 MET 1996 -->
<!-- hhmts start -->
Last modified: Thu Jan 28 18:07:56 PST 1999
<!-- hhmts end -->
  </body>

<!-- Mirrored from bos.asmhackers.net/docs/filesystems/ntfs/seqarray.html by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 07 Oct 2014 11:26:07 GMT -->
</html>
